import fse from 'fs-extra';
import pathUtil from 'path';
export const getFileExtension = (filename) => {
    const parsed = pathUtil.parse(filename);
    return parsed.ext ? parsed.ext.slice(1) : filename;
};
export const getConfigPath = async (contentDirectoryPath) => {
    const path = pathUtil.join(contentDirectoryPath, 'mint.json');
    if (!(await fse.pathExists(path)))
        return null;
    return path;
};
export const getConfigObj = async (contentDirectoryPath) => {
    const configPath = await getConfigPath(contentDirectoryPath);
    if (!configPath)
        return null;
    const configContents = await fse.readFile(configPath);
    return await JSON.parse(configContents.toString());
};
